﻿<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Pragma" content="no-cache">
<title>WebNoteEditor</title>
<link rel="STYLESHEET" type="text/css" id="SkinStyleSheet">
<style type="text/css">
form{
	margin:0px
}
#currentFolderPath{
	font-size:8pt;font-family:Verdana;color:blue;background-color:#FFFFFF;border:1px black solid;display:block;padding:3px;width:630px;margin:2px 0px 2px 0px
}
#FileBrowser{
	width:630px;height:380px;
}
.selectobjectinfo{
	width:80%
}
.selectobjectinfo2{
	
}
#file1{
	width:600px
}
#divLoad{
	filter:alpha(opacity=50);opacity:0.6;background-color:#FFFFFF;position:absolute;text-align:center;
}
#divLoad img{
	position:relative;
}
.div0{
	text-align:left
}
fieldset{
	text-align:left;width:615px;*width:630px;
}
#buttonCreateFolder{
	background:url('../images/createfolder.gif') white no-repeat;background-position:3px 2px;border:1px black solid;margin:2px 5px 0px 0px;padding:5px 3px 2px 19px
}
#buttonfiles_mode0{
	background:url('../images/createfolder.gif') white no-repeat;background-position:3px 2px;border:1px black solid;margin:2px 5px 0px 0px;padding:5px 3px 2px 19px
}
#buttonfiles_mode1{
	background:url('../images/createfolder.gif') white no-repeat;background-position:3px 2px;border:1px black solid;margin:2px 5px 0px 0px;padding:5px 3px 2px 19px
}

</style>
<script language="javascript" type="text/javascript" src="../script/ajax-min.js"></script>
<script language="javascript" type="text/javascript" src="../script/ie2w3c-min.js"></script>
<script language="javascript" type="text/javascript" src="../script/windialog.js"></script>
<script language="javascript" type="text/javascript" src="../script/cookie.js"></script>
<script language="javascript" id="ScriptFileRight" type="text/javascript"></script>
<script language="javacript" type="text/javascript">
if(navigator.userAgent.toLowerCase().indexOf("chrome")>0)
{
	$ajax.loadjs("../"+EditorWindow.$config.isapi+"/fileright_config2js."+EditorWindow.$config.isapi);
}
else
{
	document.getElementById("ScriptFileRight").src="../"+EditorWindow.$config.isapi+"/fileright_config2js."+EditorWindow.$config.isapi;	
}

window.onload=function()
{


	renderWindowAsIE(window);
	
	try
	{
		var t=FileRight_Path;
	}
	catch(e)
	{
		window.close();
		return;
	}
	
	if (!FileRight_Path || FileRight_Path=="")
	{
		window.close();
		return;
	}
	else
	{
		document.getElementById("currentFolderPath").innerText=FileRight_Path;
	}
	
	document.getElementById("btnReName").value=EditorWindow.lang_rename;
	document.getElementById("btnFolderReName").value=EditorWindow.lang_rename;
	document.getElementById("btnDelete").value=EditorWindow.lang_delete;
	document.getElementById("btnFolderDelete").value=EditorWindow.lang_delete;
	document.getElementById("btnCreateFolder").value=EditorWindow.lang_createfolder;
	document.getElementById("btnUpload").value=EditorWindow.lang_upload;
	
	if (!FileRight_Upload)
	{
		document.getElementById("file1").disabled="disabled";
		document.getElementById("btnUpload").disabled="disabled";
	}
	else
	{
		document.getElementById("f1").onsubmit=__f1_onsubmit;
		document.getElementById("f1").action="../"+EditorWindow.$config.isapi+"/fileupload."+EditorWindow.$config.isapi;
	}
	
	if (!FileRight_FileReName)
		document.getElementById("btnReName").disabled="disabled";
	else
		document.getElementById("btnReName").onclick=__btnReName_onclick;
		
	if (!FileRight_FileDelete)
		document.getElementById("btnDelete").disabled="disabled";
	else
		document.getElementById("btnDelete").onclick=__btnDelete_onclick;


	if (!FileRight_FolderCreate)
		document.getElementById("btnCreateFolder").disabled="disabled";
	else
		document.getElementById("btnCreateFolder").onclick=__btnCreateFolder_onclick;
		
	if (!FileRight_FolderReName)
		document.getElementById("btnFolderReName").disabled="disabled";
	else
		document.getElementById("btnFolderReName").onclick=__btnFolderReName_onclick;


	if (!FileRight_FolderDelete)
		document.getElementById("btnFolderDelete").disabled="disabled";
	else
		document.getElementById("btnFolderDelete").onclick=__btnFolderDelete_onclick;
	
	ListFolder(FileRight_Path);
	
	document.getElementById("checkbox_inertfileafterupload").onclick=__checkbox_inertfileafterupload_onclick;
	if (getCookie("checkbox_inertfileafterupload").toString()=="1")
	{
		document.getElementById("checkbox_inertfileafterupload").checked=true;
	}
	if (getCookie("webnoteeditor_files_mode")=="")
	{
		setCookie("webnoteeditor_files_mode","1");
	}
	
	//../images/createfolder.gif
	document.getElementById("buttonCreateFolder").onclick=createFolder;
	document.getElementById("buttonCreateFolder").innerText=EditorWindow.lang_createfolder;
	document.getElementById("buttonfiles_mode0").onclick=__buttonfiles_mode0_onclick;
	document.getElementById("buttonfiles_mode0").innerText=EditorWindow.lang_files_mode0;
	document.getElementById("buttonfiles_mode1").onclick=__buttonfiles_mode1_onclick;
	document.getElementById("buttonfiles_mode1").innerText=EditorWindow.lang_files_mode1;
	AutoResizeDialogWindow();
}

function __btnOk_onclick()
{
	window.returnValue=true;
	window.close();
}


function Fileonmouseover(sObj)
{
	sObj.style.cssText="cursor: pointer;background-color: #B5BED6; border: 1px solid #08246B;padding:2px";
}
function Fileonmouseout(sObj)
{
	sObj.style.cssText=";padding:2px";
}


function ListFolder(sFolderPath)
{
	var Url;
	with (document.getElementById("divLoad"))
	{
		style.display="";
		style.width=document.getElementById("FileBrowser").offsetWidth;
		style.height=document.getElementById("FileBrowser").offsetHeight;
		firstChild.style.marginTop=(document.getElementById("FileBrowser").offsetWidth/2);
		
		//style.left=document.getElementById("FileBrowser").offsetLeft+document.getElementById("FileBrowser").offsetParent.offsetLeft+document.getElementById("FileBrowser").offsetParent.offsetParent.offsetLeft
		//style.top=document.getElementById("FileBrowser").offsetTop+document.getElementById("FileBrowser").offsetParent.offsetTop+document.getElementById("FileBrowser").offsetParent.offsetParent.offsetTop
	}
	
	if (EditorWindow.$config.isapi!="jsp")
		sFolderPath=escape(sFolderPath);
	Url="../"+EditorWindow.$config.isapi+"/filebrowser_xml."+EditorWindow.$config.isapi+"\?folderpath="+sFolderPath;
	//window.open(Url);
	createXMLDom(Url,"",onloadFolder);
}


function onloadFolder()
{
	var isReady=false;
	var root;

	if (EditorWindow.$browser.isIE)
	{
		if (xmlDom.readyState== 4)
			isReady=true;
		else
			return;
	}
	else
	{
		isReady=true;
	}

	if (isReady)
	{
		if (EditorWindow.$browser.isIE)
		{
			var err = xmlDom.parseError;
			if (err.errorCode!=0)
			{
				alert(err.reason);
				return;
			}
			else
			{
				root=xmlDom.documentElement;
			}
		}
		else
		{
			root=xmlDom.documentElement;
		}
			if (!root)
			{
				alert(EditorWindow.tipsmsgReplace(EditorWindow.lang_tips_error_loadfolderinfo,"{0}",document.getElementById("currentFolderPath").innerText));
				return;
			}
			var i,elems;
			var fileName,fs,fileExName,fileUrl
			var errdescription=root.getElementsByTagName("errdescription")[0].firstChild.nodeValue;
			if (errdescription!="")
			{
				alert(errdescription);
			}
			else
			{
				//alert(root.xml);
				document.getElementById("currentFolderPath").innerText=unescape(root.getAttribute("folderpath"));
				with(document.getElementById("FileBrowser").contentWindow.document)
				{
					clear();
					open();
					write("<html><style>*{font-size:8pt;font-family:Verdana};body{margin:0}");
					
					if (getCookie("webnoteeditor_files_mode")=="1")
					{
						write("ul{margin:0px;padding:0px;list-style-type:none} li{margin:0px;padding:3px;list-style-type:none} .i{width:80px;height:80px}");
					}
					else
					{
						write("ul{margin:0px;padding:0px;list-style-type:none} li{margin:3px;padding:3px;list-style-type:none;float:left;text-align:center;width:100px;height:100px;border:1px #999999 solid;word-break:break-all} .i{width:80px;height:80px}");
					}
					
					write("</style><body>");
					write("<div style=\"padding:2px\">");
					write("<span style=\"width:220px\"><img src=\"../images/gotoparentfolder.gif\" style=\"cursor:pointer\" onclick=\"javascript:window.top.__gotoParentFolder();\"></span>");
					write("</div>");
					write("<ul style=\"padding-left:10px\">");

					elems=root.getElementsByTagName("subfolders")[0].getElementsByTagName("folder");
					for(i=0;i<elems.length;i++)
					{
						write("<li style=\"padding:2px\" onmouseover=\"javascript:window.top.Fileonmouseover(this);\" onmouseout=\"javascript:window.top.Fileonmouseout(this);\" onclick=\"javascript:window.top.__Folderonclick(this);\" ondblclick=\"javascript:window.top.__Folderondblclick('"+elems[i].firstChild.nodeValue+"',this);\" foldername=\""+elems[i].firstChild.nodeValue+"\"><img src=\"../images/folder.gif\" style=\"margin-bottom:-2px;margin-right:2px\">"+elems[i].firstChild.nodeValue+"</li>");
					}
					elems=null;
					
					elems=root.getElementsByTagName("files")[0].getElementsByTagName("file");

					for(i=0;i<elems.length;i++)
					{
						fn=elems[i].getElementsByTagName("filename")[0].firstChild.nodeValue;
						fs=EditorWindow.FileSizeToString(elems[i].getElementsByTagName("filesize")[0].firstChild.nodeValue);
						fileExName=EditorWindow.getFileExt(elems[i].getElementsByTagName("fileexname")[0].firstChild.nodeValue);
						fileUrl=document.getElementById("currentFolderPath").innerText + "/" + fn;
						if (EditorWindow.$config.allow_upload_file_ext.isInArray(fileExName))
						{
							write("<li style=\"padding:2px;\" onmouseover=\"javascript:window.top.Fileonmouseover(this);\" onmouseout=\"javascript:window.top.Fileonmouseout(this);\" onclick=\"javascript:window.top.__Fileonclick(this);\" ondblclick=\"javascript:window.top.__Fileondblclick(this);\" fileName=\""+fn+"\" title=\""+fn+"\">");
							
							if (getCookie("webnoteeditor_files_mode")=="1")
							{
								write("<a style=\"float:left;width:510px;overflow: hidden;text-overflow:ellipsis;white-space: nowrap;\"><img src=\"../images/filetype/"+fileExName+".gif\" style=\"margin-bottom:-2px;margin-right:2px\">"+fn+"</a>");
								write("<a style=\"float:left;width:80px;text-align:right;font-size:7pt;color:#999999\">"+fs+"</a>");
							}
							else
							{
								if (EditorWindow.$config.allow_upload_image_ext.isInArray(fileExName))
								{
									write("<img class=\"i\" src=\""+fileUrl+"\">");
								}
								else
								{
									write("<a><img src=\"../images/filetype/"+fileExName+".gif\" style=\"margin-bottom:2px;margin-right:2px\"><br>"+fn+"</a>");
								}
							}
							if (!EditorWindow.$browser.isIE)
								write ("<div style=\"clear:both;height:0px\"></div>");
							write("</li>");
						}
					}
					elems=null;

					write("</ul>");
					write("</body></html>");
					close();
				}
			}
			document.getElementById("divLoad").style.display="none";
			//alert(root.xml);
			
	}
	root=null;
}


function __Fileonclick(sObj)
{

	document.getElementById("legendinfo").innerText=EditorWindow.lang_file + EditorWindow.lang_info;
	document.getElementById("opabuttons").style.display="";
	document.getElementById("opabuttons1").style.display="none";
	document.getElementById("opabuttons2").style.display="none";
	
	var sfilePath,fileExName;

	if (sObj.tagName=="LI")
	{
		sfilePath=document.getElementById("currentFolderPath").innerText + "/" + sObj.getAttribute("fileName");
		document.getElementById("selectobjectinfo").value=sObj.getAttribute("fileName");
	}
	else if (sObj.tagName=="IMG")
	{
		sfilePath=document.getElementById("currentFolderPath").innerText + "/" + sObj.parentElement.getAttribute("fileName");
		document.getElementById("selectobjectinfo").value=sObj.parentElement.getAttribute("fileName");
	}
	else
	{
		return;
	}

	fileExName=EditorWindow.getFileExt(sfilePath);
	document.getElementById("ReNameTo").value=document.getElementById("selectobjectinfo").value;
	return;
	
	if (EditorWindow.$config.allow_upload_image_ext.isInArray(fileExName))
	{
		document.getElementById("imgPreview").src=sfilePath;
		document.getElementById("imgPreview").style.display="";
	}
	else
	{
		document.getElementById("imgPreview").style.display="none";
	}
	

}

function __Fileondblclick(sObj)
{
	var FlashHtml,sHTML,fileExName,MediaPlayerString;
	var FLVPlayerURL;
	var sfilePath;
	if (sObj.tagName=="LI")
	{
		sfilePath=document.getElementById("currentFolderPath").innerText + "/" + sObj.getAttribute("fileName");
		document.getElementById("selectobjectinfo").value=sObj.getAttribute("fileName");
	}
	else if (sObj.tagName=="A")
	{
		sfilePath=document.getElementById("currentFolderPath").innerText + "/" + sObj.parentElement.getAttribute("fileName");
		document.getElementById("selectobjectinfo").value=sObj.parentElement.getAttribute("fileName");
	}
	else
	{
		return;
	}
	EditorWindow.__insertFile(sfilePath,true);

}


function __Folderonclick(sObj)
{
	document.getElementById("legendinfo").innerText=EditorWindow.lang_folder + EditorWindow.lang_info;
	document.getElementById("opabuttons").style.display="none";
	document.getElementById("opabuttons1").style.display="none";
	document.getElementById("opabuttons2").style.display="";
	
	var sfilePath,sObj;
	//var event=(window.parent.event?window.parent.event:event);
	//sObj=event.srcElement;

	if (sObj.tagName=="LI")
	{
		sfilePath=document.getElementById("currentFolderPath").innerText + "/" + sObj.getAttribute("foldername");
		document.getElementById("selectobjectinfo").value=sObj.getAttribute("foldername");
	}
	else if(sObj.tagName=="IMG")
	{
		sfilePath=document.getElementById("currentFolderPath").innerText + "/" + sObj.getAttribute("foldername");
		document.getElementById("selectobjectinfo").value=sObj.getAttribute("foldername");
	}
	else
		return;
	document.getElementById("ReNameTo").value=document.getElementById("selectobjectinfo").value;
}


function __Folderondblclick(sFolderName,sObj)
{
	var sFolderPath;
	document.getElementById("ReNameTo").value="";
	document.getElementById("selectobjectinfo").value="";
	document.getElementById("opabuttons").style.display="none";
	document.getElementById("opabuttons1").style.display="none";
	document.getElementById("opabuttons2").style.display="none";

	sFolderPath=document.getElementById("currentFolderPath").innerText+"/"+sFolderName;
	ListFolder(sFolderPath);
}

function __gotoParentFolder()
{
	var sFolderPath;
	sFolderPath=EditorWindow.getParentFolderPath(document.getElementById("currentFolderPath").innerText,"/");
	ListFolder(sFolderPath);
}

function __resetOPA()
{
	ReNameTo.value=""
	document.getElementById("selectobjectinfo").value="";
	document.getElementById("opabuttons").style.display="none";
	document.getElementById("opabuttons1").style.display="none";
	document.getElementById("opabuttons2").style.display="none";
}

function createFolder()
{
	__resetOPA();
	document.getElementById("opabuttons1").style.display="";
}



function __btnCreateFolder_onclick()
{
	var sFolderPath,Url,root,returnValue;
	sFolderPath=document.getElementById("currentFolderPath").innerText+"/"+document.getElementById("ReNameTo").value;
	if (sFolderPath.trim()=="")
		return;
	
	document.getElementById("legendinfo").innerText=EditorWindow.lang_createfolder;
	
	//window.open "../"&Define_Server_ISAPI&"/bs."&Define_Server_ISAPI&"?act=createfolder&data="&Escape(sFolderPath)
	
	if (EditorWindow.$config.isapi=="jsp")
		root=EditorWindow.__XMLHttpRequest(EditorWindow.$config.isapi+"/bs."+EditorWindow.$config.isapi,"POST","act=createfolder&data="+sFolderPath,"xml");
	else
		root=EditorWindow.__XMLHttpRequest(EditorWindow.$config.isapi+"/bs."+EditorWindow.$config.isapi,"POST","act=createfolder&data="+escape(sFolderPath),"xml");
	
	returnValue=root.getElementsByTagName("returnvalue")[0].firstChild.nodeValue;

	if (returnValue=="true")
	{
		alert(EditorWindow.tipsmsgReplace(EditorWindow.lang_createfolder_ok,"{0}",document.getElementById("ReNameTo").value));
		document.getElementById("ReNameTo").value="";
		document.getElementById("selectobjectinfo").value="";
		ListFolder(document.getElementById("currentFolderPath").innerText);
	}
	else
	{
		alert(EditorWindow.tipsmsgReplace(EditorWindow.lang_createfolder_error,"{0}|{1}",document.getElementById("ReNameTo").value+"|"+document.getElementById("ReNameTo").value));
	}
	
	createFolder();
}

function __btnFolderReName_onclick()
{
	var sFolderPath,root,returnValue;
	sFolderPath=document.getElementById("currentFolderPath").innerText+"/"+document.getElementById("selectobjectinfo").value;
	sReNameTo=document.getElementById("ReNameTo").value;
	
	if (sReNameTo.toLowerCase()==document.getElementById("selectobjectinfo").value.toLowerCase())
	{
		return;
	}

	if (EditorWindow.$config.isapi=="jsp")
		root=EditorWindow.__XMLHttpRequest(EditorWindow.$config.isapi+"/bs."+EditorWindow.$config.isapi,"POST","act=folderrename&data="+sFolderPath+"|"+sReNameTo,"xml");
	else
		root=EditorWindow.__XMLHttpRequest(EditorWindow.$config.isapi+"/bs."+EditorWindow.$config.isapi,"POST","act=folderrename&data="+sFolderPath+"|"+sReNameTo,"xml");


	returnValue=root.getElementsByTagName("returnvalue")[0].firstChild.nodeValue;

	if (returnValue=="true")
	{
		alert(EditorWindow.tipsmsgReplace(EditorWindow.lang_rename_folder_ok,"{0}|{1}",document.getElementById("selectobjectinfo").value+"|"+document.getElementById("ReNameTo").value));
		ListFolder(document.getElementById("currentFolderPath").innerText);
		document.getElementById("selectobjectinfo").value=document.getElementById("ReNameTo").value;
	}
	else
	{
		alert(EditorWindow.tipsmsgReplace(EditorWindow.lang_rename_folder_error,"{0}|{1}",document.getElementById("selectobjectinfo").value+"|"+document.getElementById("ReNameTo").value));
	}
}

function __btnReName_onclick()
{
	var sFilePath,root,returnValue;
	sFilePath=document.getElementById("currentFolderPath").innerText+"/"+document.getElementById("selectobjectinfo").value;
	sReNameTo=document.getElementById("ReNameTo").value;
	
	if (sReNameTo.toLowerCase()==document.getElementById("selectobjectinfo").value.toLowerCase())
	{
		return;
	}
	
	if (EditorWindow.$config.isapi=="jsp")
		root=EditorWindow.__XMLHttpRequest(EditorWindow.$config.isapi+"/bs."+EditorWindow.$config.isapi,"POST","act=filerename&data="+sFilePath+"|"+sReNameTo,"xml");
	else
		root=EditorWindow.__XMLHttpRequest(EditorWindow.$config.isapi+"/bs."+EditorWindow.$config.isapi,"POST","act=filerename&data="+escape(sFilePath+"|"+sReNameTo),"xml");
	//alert(root);
	returnValue=root.getElementsByTagName("returnvalue")[0].firstChild.nodeValue;
	
	if (returnValue=="true")
	{
		alert(EditorWindow.tipsmsgReplace(EditorWindow.lang_filerename_ok,"{0}|{1}",selectobjectinfo.value+"|"+sReNameTo));
		ListFolder(document.getElementById("currentFolderPath").innerText);
		document.getElementById("selectobjectinfo").value=document.getElementById("ReNameTo").value;
	}
	else
	{
		alert(EditorWindow.tipsmsgReplace(EditorWindow.lang_filerename_error,"{0}|{1}",document.getElementById("selectobjectinfo").value+"|"+sReNameTo));
	}
}

function __btnDelete_onclick()
{
	if (!confirm(EditorWindow.tipsmsgReplace(EditorWindow.lang_confirm_deletefile,"{0}",document.getElementById("selectobjectinfo").value)))
		return;

	var sFilePath,root,returnValue;
	sFilePath=document.getElementById("currentFolderPath").innerText+"/"+document.getElementById("selectobjectinfo").value;
	
	if (document.getElementById("selectobjectinfo").value.trim()=="")
		return;
	
	if (EditorWindow.$config.isapi=="jsp")
		root=EditorWindow.__XMLHttpRequest(EditorWindow.$config.isapi+"/bs."+EditorWindow.$config.isapi,"POST","act=filedelete&data="+sFilePath,"xml");
	else
		root=EditorWindow.__XMLHttpRequest(EditorWindow.$config.isapi+"/bs."+EditorWindow.$config.isapi,"POST","act=filedelete&data="+escape(sFilePath),"xml");

	returnValue=root.getElementsByTagName("returnvalue")[0].firstChild.nodeValue;
	
	if (returnValue=="true")
	{
		alert(EditorWindow.tipsmsgReplace(EditorWindow.lang_filedelete_ok,"{0}",document.getElementById("selectobjectinfo").value));
		document.getElementById("ReNameTo").value="";
		document.getElementById("selectobjectinfo").value="";
		ListFolder(document.getElementById("currentFolderPath").innerText);
	}
	else
	{
		alert(EditorWindow.tipsmsgReplace(EditorWindow.lang_filedelete_error,"{0}",document.getElementById("selectobjectinfo").value));
	}
	__resetOPA();
}


function __btnFolderDelete_onclick()
{
	if (!confirm(EditorWindow.tipsmsgReplace(EditorWindow.lang_confirm_deletefolder,"{0}",document.getElementById("selectobjectinfo").value)))
		return;

	var sFolderPath,root,returnValue;
	sFolderPath=document.getElementById("currentFolderPath").innerText+"/"+document.getElementById("selectobjectinfo").value;

	if (document.getElementById("selectobjectinfo").value.trim()=="")
		return;

	if (EditorWindow.$config.isapi=="jsp")
		root=EditorWindow.__XMLHttpRequest(EditorWindow.$config.isapi+"/bs."+EditorWindow.$config.isapi,"POST","act=folderdelete&data="+sFolderPath,"xml");
	else
		root=EditorWindow.__XMLHttpRequest(EditorWindow.$config.isapi+"/bs."+EditorWindow.$config.isapi,"POST","act=folderdelete&data="+escape(sFolderPath),"xml");


	returnValue=root.getElementsByTagName("returnvalue")[0].firstChild.nodeValue;

	if (returnValue=="true")
	{
		alert(EditorWindow.tipsmsgReplace(EditorWindow.delete_folder_ok,"{0}",document.getElementById("selectobjectinfo").value));
		document.getElementById("ReNameTo").value="";
		document.getElementById("selectobjectinfo").value="";
		ListFolder(document.getElementById("currentFolderPath").innerText);
	}
	else
	{
		alert(EditorWindow.tipsmsgReplace(EditorWindow.lang_filedelete_error,"{0}",document.getElementById("selectobjectinfo").value));
	}
	__resetOPA();
}

function __f1_onsubmit()
{
	var extName;

	if (document.getElementById("file1").value!="")
	{
		extName=EditorWindow.getFileExt(document.getElementById("file1").value);
		if (EditorWindow.$config.allow_upload_file_ext.isInArray(extName))
		{

			//root=EditorWindow.__XMLHttpRequest(EditorWindow.$config.isapi+"/bs."+EditorWindow.$config.isapi,"POST","act=fileexists2&data="+document.getElementById("currentFolderPath").innerText+"/"+EditorWindow.getFileName(document.getElementById("file1").value),"xml");

			//alert(root);
			
			root=EditorWindow.__XMLHttpRequest(EditorWindow.$config.isapi+"/bs."+EditorWindow.$config.isapi,"POST","act=fileexists2&data="+document.getElementById("currentFolderPath").innerText+"/"+EditorWindow.getFileName(document.getElementById("file1").value),"xml");

			var returnValue=root.getElementsByTagName("returnvalue")[0].firstChild.nodeValue;
			
			if (returnValue=="true")
			{

				alert(EditorWindow.tipsmsgReplace(EditorWindow.lang_upload_fileexisted,"{0}",EditorWindow.getFileName(document.getElementById("file1").value)));
				if (!confirm(EditorWindow.lang_upload_overwirte))
					return false;
			}
			document.getElementById("divupload").style.display="";
			document.getElementById("UpLoadStatus").innerText=EditorWindow.lang_uploading_image;
			document.getElementById("f1").style.display="none";
			document.getElementById("folderpath").value=escape(currentFolderPath.innerText);
			return true;

		}
		else
		{
			alert(EditorWindow.lang_error_upload_unknowfile);
		}
	}
	else
	{
		alert(EditorWindow.lang_select_uploadfile);
	}
	return false;
}



function UploadState(sCase,sFileURL)
{
	switch(sCase)
	{
		case 0:
			//alert("ok");
			alert(EditorWindow.tipsmsgReplace(EditorWindow.lang_upload_ok,"{0}",EditorWindow.getFileName(document.getElementById("file1").value),"/"));
			if (sFileURL && document.getElementById("checkbox_inertfileafterupload").checked)
			{
				EditorWindow.__insertFile(sFileURL,true);
				window.close();
			}
			break;
		case 1:alert(EditorWindow.tipsmsgReplace(EditorWindow.lang_upload_error0,"{0}",EditorWindow.getFileName(document.getElementById("file1").value),"/"));break;
		case 2:alert(EditorWindow.lang_upload_largerthanmax);break;
		default:
	}
	var sFolderPath;
	sFolderPath=document.getElementById("currentFolderPath").innerText;
	ListFolder(sFolderPath);
	document.getElementById("divupload").style.display="none";
	document.getElementById("f1").style.display="";
}

function __checkbox_inertfileafterupload_onclick()
{
	var elem=document.getElementById("checkbox_inertfileafterupload");
	if (elem.checked)
		setCookie("checkbox_inertfileafterupload","1");
	else
		setCookie("checkbox_inertfileafterupload","0");
}

function __buttonfiles_mode0_onclick()
{
	setCookie("webnoteeditor_files_mode","0");
	ListFolder(document.getElementById("currentFolderPath").innerText);
}

function __buttonfiles_mode1_onclick()
{
	setCookie("webnoteeditor_files_mode","1");
	ListFolder(document.getElementById("currentFolderPath").innerText);
}

</script>
</head>

<body class="dialog">
<script language="javascript" type="text/javascript">dialogTitle("lang_insertfilefromwebsite");</script>
<div style="padding-bottom:3px">
	<a id="buttonCreateFolder"></a>
	<a id="buttonfiles_mode0"></a>
	<a id="buttonfiles_mode1"></a>
</div>

<a id="currentFolderPath"><script language="javascript" type="text/javascript"></script></a>
<div id="divLoad"><img src="../images/progressbar.gif" alt=""></div>
<div>
	<iframe src="../inc/null.htm" id="FileBrowser" name="FileBrowser"></iframe>
</div>
<div class="alerttext"><script type="text/javascript" language="javascript">dialogPrintlang("lang_insertfilefromwebsite_tips0")</script></div>
<div>
	<fieldset style="height:60px;"><legend><script language="javascript" type="text/javascript">dialogPrintlang("lang_upload")</script></legend>
		<div id="divupload" style="display:none">
			<img src="../images/progressbar.gif" id="ProgressBar1" alt="">
			<div id="UpLoadStatus"></div>
		</div>
		<form action="" method="post" id="f1" target="FileBrowser" enctype="multipart/form-data" style="margin:0">
			<input type="file" name="file1" id="file1"><br>
			<input type="hidden" name="folderpath" id="folderpath">
			<div>
				<input type="checkbox" name="inertfileafterupload" value="ON" id="checkbox_inertfileafterupload"><script language="javascript" type="text/javascript">dialogPrintlang("lang_insertfileafterupload")</script><input type="submit" id="btnUpload" class="SysBtn2">
			</div>
		</form>
	</fieldset>

	<fieldset style="height:68px;"><legend id="legendinfo"><script language="javascript" type="text/javascript">dialogPrintlang("lang_info")</script></legend>
		<input type="text" id="ReNameTo" class="selectobjectinfo">
		<input type="hidden" id="selectobjectinfo">
		<div id="opabuttons" style="display:none">
			<input type="button" id="btnReName" class="SysBtn2">
			<input type="button" id="btnDelete" class="SysBtn2">
		</div>
		<div id="opabuttons1" style="display:none">
			<input type="button" id="btnCreateFolder" class="SysBtn5">
		</div>
		<div id="opabuttons2" style="display:none">
			<input type="button" id="btnFolderReName" class="SysBtn2">
			<input type="button" id="btnFolderDelete" class="SysBtn2">
		</div>
	</fieldset>
</div>
<div class="buttons">
	<hr size="1" color="#B3AC9D">
	<script language="javascript" type="text/javascript">
		PrintButtons3();
	</script>
</div>


</body>

</html>
